package oauth2.client;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.utils.Enum.permissionForSecurity.UserPermission;
import oauth2.feign.PrivderClient;
import user.OnlineUserInterface;




/**
 * oauth2测试客户端
 * 
 * @description 
 * @author monxz
 * @date 2020年8月27日
 *
 */
@RestController
public class TestController {
	
	@Autowired
	private OnlineUserInterface userInterface;
	
	@RequestMapping("/test")
	@PreAuthorize("hasAuthority('"+UserPermission.no_check+"')")
	public Object  noPermission() {
		System.err.println("===1231213123123");
		System.err.println(userInterface.getNowUser());
		return "wufa";
	}
	
	@RequestMapping("/user")
	@PreAuthorize("hasAuthority('USER')")
	public Object  user() {
		return "获取到当前用户";
	}
	
	
	@GetMapping("/uur")
	@PreAuthorize("hasAuthority('UUR')")
	public Object  uur() {
		return "无法获取到用户";
	}

	
}
